﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WCS.Infrastructure.Dto.Common;

namespace WCS.Infrastructure.Dto.Request.User
{
    /// <summary>
    /// 用户表对象
    /// </summary>
    public class UserRequestDto : BaseRequestDto
    {
        /// <summary>
        /// 用户Id
        /// </summary>
        [Key]
        [StringLength(32)]
        public string? Id { get; set; } = null!;

        /// <summary>
        /// 用户名
        /// </summary>
        [StringLength(255)]
        public string? Name { get; set; }

        /// <summary>
        /// 手机号
        /// </summary>
        [StringLength(11)]
        public string? Phone { get; set; } = null!;

        /// <summary>
        /// 密码
        /// </summary>
        [StringLength(32)]
        public string? Password { get; set; }

        /// <summary>
        /// 邮箱
        /// </summary>
        [StringLength(255)]
        public string? Email { get; set; }

        /// <summary>
        /// 用户头像URL
        /// </summary>
        [StringLength(255)]
        public string? AvatarUrl { get; set; }

        /// <summary>
        /// 用户状态：0=禁用，1=启用
        /// </summary>
        public int? EnableStatus { get; set; }

        /// <summary>
        /// 用户最后登录时间
        /// </summary>
        [Column(TypeName = "timestamp(6) without time zone")]
        public DateTime? LastLoginTime { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [Column(TypeName = "timestamp(6) without time zone")]
        public DateTime? CreationTime { get; set; }

        /// <summary>
        /// 账户余额，单位为分
        /// </summary>
        public long? Balance { get; set; }

        /// <summary>
        /// 冻结余额，单位为分
        /// </summary>
        public long? BlockedBalance { get; set; }

        /// <summary>
        /// 可提现余额，单位为分
        /// </summary>
        public long? WithdrawableBalance { get; set; }

        /// <summary>
        /// 未结算余额，单位为分
        /// </summary>
        public long? UnsettledBalance { get; set; }

        /// <summary>
        /// 待分账余额，单位为分
        /// </summary>
        public long? DividedBalance { get; set; }
    }

    public class UserPasswordUpdateRequestDto
    {
        /// <summary>
        /// 手机号
        /// </summary>
        [StringLength(11)]
        public string? PhoneNumber { get; set; }
        /// <summary>
        /// 新密码
        /// </summary>
        [StringLength(32)]
        public string? NewPassword { get; set; }
    }

    public class UserAvatarUpdateRequestDto
    {
        /// <summary>
        /// 用户Id
        /// </summary>
        [Key]
        [StringLength(32)]
        public string? Id { get; set; } = null!;
        /// <summary>
        /// 用户头像URL
        /// </summary>
        [StringLength(255)]
        public string? AvatarUrl { get; set; }
    }
}
